#ifndef FORMATTEDEDITOR_H
#define FORMATTEDEDITOR_H

#include <QTextEdit>
#include <QtGui>
#include <QFile>
#include "userhighlighter.h"

class FormattedEditor : public QTextEdit
{
	Q_OBJECT

	private:
		QString fileName;
		QToolBar *toolBar;
		QAction *bold;
		QAction *italic;
		QAction *underline;
		QFontComboBox *font;
		QComboBox *fontSize;
		QAction *leftAlign;
		QAction *centreAlign;
		QAction *rightAlign;
		QAction *justifyAlign;
		QAction *bullets;
		QAction *numbers;
		QAction *colour;
		QAction *textBackgroundColour;
                QAction *userHighlight;
		bool modsSaved;
		QFile file;
                userhighlighter *highlighter;

	public:
		explicit FormattedEditor(QToolBar *newToolbar, QWidget *parent = 0);
		void setFileName(const QString newFileName) { file.setFileName(newFileName); }
		QString getFileName() const { return file.fileName(); }
		static bool isFormattedFile(const QString fileName);
		void saveFile();

	public slots:
		void setBold(const bool bold);
		void setFontSize(const QString newSize);
		void setLeftAlign(const bool align);
		void setCentreAlign(const bool align);
		void setRightAlign(const bool align);
		void setJustifyAlign(const bool align);
		void setBulletFormatter(const bool bulletsOn);
		void setNumberFormatter(const bool numbersOn);
		void chooseFontColour();
		void chooseFontBackgroundColor();
};

#endif // FORMATTEDEDITOR_H
